1. Field of the Invention
The present invention relates to an apparatus for encoding video data, and more particularly, to an apparatus for controlling a quantization step size based on buffer occupancy and image complexity.
2. Description of Related Art
Generally, a system such as a high definition television, a digital video cassette recorder and a digital camcoder for digitally processing an image signal and an acoustic signal, digitally encodes moving pictures and acoustic signals related to the moving pictures and transmits the encoded signals, and then receives and decodes the transmitted signals. When the encoded data is transmitted through a transmission path having a constant transmission rate, an encoder needs to control an amount of the generated data. To transmit the encoded data at a constant transmission rate, an apparatus for determining a quantization step size is needed and will be described with reference to FIG. 1.
FIG. 1 is a block diagram of a general encoder for compressing moving pictures and transmitting the compressed data at a constant transmission rate. Since the FIG. 1 apparatus is well known to a person skilled in the art, the operation thereof will be briefly described below.
In FIG. 1, the video data of the present frame is applied to a subtracter 31 and a motion estimator 18. Motion estimator 18 uses video data applied from an external video data source and video data stored in a frame memory 17 and generates a motion vector signal. The motion vector signal is generated every block of N(the number of horizontal pixels).times.N(the number of vertical pixels) pixels (usually 8.times.8 pixels) formed by the video data of the present frame, and supplied to a motion compensator 19 and a transmission channel. Motion compensator 19 supplies the video data corresponding to the motion vector among the data stored in frame memory 17 to switches 33 and 34. Switches 33 and 34 are turned on if the FIG. 1 apparatus operates in an inter-frame mode, while the former are turned off if the latter operates in an intra-frame mode. When switch 33 is turned on, subtracter 31 subtracts the data supplied via switch 33 from motion compensator 19, from the externally-supplied video data and generates differential data. On the other hand, if switch 33 is turned off, subtracter 31 supplies the externally-supplied video data to a transformer 11 as it is. Transformer 11 transforms the data output from subtracter 31 into a frequency domain transformation coefficient. Such transformation is accomplished in units of blocks. The transformation coefficients output from transformer 11 are supplied to a quantizer 12. Quantizer 12 quantizes the transformation coefficients according to a quantization step size supplied from a buffer 14 and supplies the quantized transformation coefficients to a variable-length coder 13 and an inverse quantizer 15. Such quantization is accomplished in units of blocks. Variable-length coder 13 variable-length-codes the input data on the basis of a statistical characteristic of the data. Inverse quantizer 15 inversely quantizes the transformation coefficients quantized by quantizer 12 and outputs the result to an inverse transformer 16. Inverse quantizer 15 performs an inverse processing of the signal processing of quantizer 12. Inverse transformer 16 transforms the input coefficient into spatial domain video data. An adder 32 adds the data supplied via switch 34 from motion compensator 19 and the data supplied from inverse transformer 16 and outputs the result to frame memory 17. Frame memory 17 stores the data which is sequentially updated by the externally-supplied video data, by a quantity of one frame. The data stored in frame memory 17 is used for motion estimation and compensation in motion estimator 18 and motion compensator 19, respectively. On the other hand, buffer 14 maintains a constant data transmission rate and generates a quantization step size signal every macroblock according to buffer occupancy of the stored data. The macroblock is composed of 16.times.16 pixels. The quantization step size signal and the encoded data output from the buffer 14 are supplied to an apparatus of FIG. 2 via a transmission channel.
The FIG. 2 apparatus which decodes the encoded motion pictures uses the quantization step size signal and the motion vector signal and decodes the data encoded by the FIG. 1 apparatus. More specifically, variable-length decoder 21 performs an inverse processing of a signal processing of variable-length coder 13. Inverse quantizer 22 inversely quantizes the data supplied from variable-length decoder 21 according to the quantization step size signal. Inverse transformer 23 transforms the input frequency domain data into a spatial domain data. Adder 35 adds the data supplied via switch 36 from motion compensator 24 and the data output from inverse transformer 23. Frame memory 25 stores the data output from adder 35 by a quantity of one frame. Motion compensator 24 reads data corresponding to the motion vector signal generated by the FIG. 1 apparatus from motion estimator 18 and supplies the read data to switch 36. The FIG. 2 apparatus which operates in this manner decodes the data encoded in the FIG. 1 apparatus. The video data output from adder 35 is displayed on a display.
However, since the above-described quantizer 12 is a kind of a loss encoder, the data prior to being quantized is not the same as the inversely quantized data after being quantized. Thus, when the video data is quantized according to a quantization step size given in units of a block having a predetermined magnitude such as a macroblock, a viewer may visually recognize a boundary line between blocks on a picture screen. Such a blocking effect is not so well recognized by the viewer in the case of a complicated picture. However, the blocking effect appearing in a simple picture, or in a picture having an edge visually recognized as an outline because of an abrupt change in brightness of an image, is well recognized by the viewer, thereby lowering the quality of the picture.
A technology of determining a quantization step size in order to provide a better quality of picture is disclosed in U.S. Pat. No. 5,038,200 to Hang issued on Aug. 6, 1991. A buffer/quantizer controller of the above prior art generates a target quantization step size signal in response to an average quantization step size signal of a previous frame and fullness indication of an output buffer.
Another prior art technology for determining a quantization step size is a rate control technology of determining a quantization step size by using image complexity supplied from a forward analyzer and a buffer state supplied from an output buffer.